

def create_function(sel='求长度'):
    if sel == '求长度':
        return len
    elif sel == '求最大':
        return max
    elif sel == '求最小':
        return min
    elif sel == '求平均':
        def myavg(iterable):
            return sum(iterable) / len(iterable)
        return myavg
scores = [60, 90, 80, 70]
fx = create_function()
print(fx(scores))  # 4
fx = create_function('求最小')
print(fx(scores))  # 60
fx = create_function('求平均')
print(fx(scores))  # 75.0